Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@noble/hashes

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noble/hashes

Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8M
increased by0.18%
Maintainers
0
Weekly downloads
 
Created

What is @noble/hashes?

The @noble/hashes npm package provides a collection of cryptographic hash functions implemented in pure JavaScript with a focus on security and performance. It is part of the noble family of packages, which are designed to be secure, efficient, and easy to use.

What are @noble/hashes's main functionalities?

SHA-256 Hashing

This feature allows you to compute the SHA-256 hash of an input. The code sample demonstrates how to hash a Uint8Array of bytes and print the resulting hash as a hex string.

"use strict";
const { sha256 } = require('@noble/hashes/sha256');
const hash = sha256(new Uint8Array([1, 2, 3]));
console.log(Buffer.from(hash).toString('hex'));

SHA-1 Hashing

This feature enables SHA-1 hashing. The code sample shows how to hash a Uint8Array and output the hash in hexadecimal format.

"use strict";
const { sha1 } = require('@noble/hashes/sha1');
const hash = sha1(new Uint8Array([1, 2, 3]));
console.log(Buffer.from(hash).toString('hex'));

RIPEMD-160 Hashing

This feature provides RIPEMD-160 hashing capability. The code sample illustrates hashing a byte array and converting the hash to a hex string.

"use strict";
const { ripemd160 } = require('@noble/hashes/ripemd160');
const hash = ripemd160(new Uint8Array([1, 2, 3]));
console.log(Buffer.from(hash).toString('hex'));

HMAC

This feature allows for the creation of HMACs (Hash-based Message Authentication Codes) using a specified hash function. The code sample demonstrates creating an HMAC with SHA-256.

"use strict";
const { hmac } = require('@noble/hashes/hmac');
const { sha256 } = require('@noble/hashes/sha256');
const key = new Uint8Array([1, 2, 3, 4, 5]);
const message = new Uint8Array([6, 7, 8, 9, 0]);
const signature = hmac(sha256, key, message);
console.log(Buffer.from(signature).toString('hex'));

Other packages similar to @noble/hashes

Keywords

FAQs

Package last updated on 01 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc